
function isDateFormat(d) {
    var df = /[0-9]{4}[-/][0-9]{2}[-/][0-9]{2}/;
    return d.match(df);
}

function na_open_window(parm)
{
	var url ='/showbiz/memberFavorite.action?uqUserId=' + parm ;		
	var	toolbar_str = 'no';
	var menubar_str = 'no';
	var statusbar_str = 'no';
	var scrollbar_str = 'no';
	var resizable_str = 'no';
	window.open(url, 'リクエストの内容確認', 'left=0, top=0, width='+780+',height='+540+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollerbars='+scrollbar_str+',resizable='+resizable_str);
}

function checkdate(param){
	var Obj = document.getElementById(param);
	var str  = Obj.value;
	var leng = str.length;

	if (leng == 10){
		
	    if(!isDateFormat(str)) {
	    	alert("間違い形式です。");
	        return false;
	    }
	    
		var strYear = str.substring(0, 4);
		var strMon = str.substring(5, 7);
		var strDate = str.substring(8, 10);
		var dat_option = strYear % 4;
		
		if (strMon == "02") {
			if (((dat_option == 0) && (strDate > 29)) || ((dat_option != 0) && (strDate > 28)) ) {
				Obj.value = str.slice(0,8);
				alert("間違い形式です。");
				return false; 
			}
		}else if ((strMon == "04") || (strMon == "06") || (strMon == "09") ||(strMon == "11")) 
		{
			if (strDate > 30) 
			{
				Obj.value = str.slice(0,8);
				alert("間違い形式です。");
				return false;  
			}
		}
		else if ((strMon == "01") || (strMon == "03") || (strMon == "05") ||
				(strMon == "07") || (strMon == "08") ||(strMon == "10") ||(strMon == "12")) 
		{
			if (strDate > 31) 
			{
				Obj.value = str.slice(0,8);
				alert("間違い形式です。");
				return false; 
			}   
		} 
		
	}
	
}

function divShowCtl(divNm1, divNm2){
	var divObj1 = document.getElementById(divNm1);
	var divObj2 = document.getElementById(divNm2);
	//
	if(divObj2.style.display == ""){
		divObj2.style.display = "none";
		divObj1.style.display = "";
	}
	else{
		divObj2.style.display = "";
		divObj1.style.display = "none";
	}
}

function jsAction(action)
{
	document.mainform.action = action;
	document.mainform.submit();
}
function resize(img){
   
   
   // width, height MaxSize
   resizeP("mvga")
   resizeP("mqvga")
   resizeP("ovga1")
   resizeP("oqvga1")
   resizeP("ovga2")
   resizeP("oqvga2")
   
}

function resizeP(img ){
	
	   var divObj1 = document.getElementById(img);
	   var width = divObj1.width;
	   var height = divObj1.height;
	   
	   
	   // width, height MaxSize
	   var maxWidth = width * 0.3;   
	   var maxHeight = height * 0.3;
	   
	   var resizeWidth = 0;
	   var resizeHeight = 0;
	   
	   if(width > maxWidth || height > maxHeight){
	      if(width > height){
	    	  
	         resizeWidth = maxWidth;
	         resizeHeight = Math.round((height * resizeWidth) / width);
	         
	      }else{
	    	  
	         resizeHeight = maxHeight;
	         resizeWidth = Math.round((width * resizeHeight) / height);
	      }
	   }else{
	      resizeWidth = width;
	      resizeHeight = height;
	   }
	   
	   divObj1.width = resizeWidth;
	   divObj1.height = resizeHeight;
	}

function divShowCtl(divNm1, divNm2){
	var divObj1 = document.getElementById(divNm1);
	var divObj2 = document.getElementById(divNm2);
	//
	if(divObj2.style.display == ""){
		divObj2.style.display = "none";
		divObj1.style.display = "";
	}
	else{
		divObj2.style.display = "";
		divObj1.style.display = "none";
	}
}
